﻿namespace MobileTrack.Core.Model
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Services.Common;

    [Table("Seguimientos")]
    [EntityPropertyMapping("Fecha", SyndicationItemProperty.Updated, SyndicationTextContentKind.Plaintext, true)]
    [EntityPropertyMapping("Id", SyndicationItemProperty.Title, SyndicationTextContentKind.Plaintext, true)]
    [EntityPropertyMapping("Comprobante", SyndicationItemProperty.Summary, SyndicationTextContentKind.Plaintext, true)]
    public class Seguimiento : BaseEntity
    {
        public long CelularId { get; set; }

        public long SucursalId { get; set; }

        public Guid ResponsableId { get; set; }

        [Column(TypeName = "date")]
        public DateTime Fecha { get; set; }

        [NotMapped]
        public Estado Estado
        {
            get
            {
                return (Estado)this.EstadoInt;
            }

            set
            {
                this.EstadoInt = (int)value;
            }
        }

        [Required]
        [MaxLength(55)]
        public string Comprobante { get; set; }
        
        [ForeignKey("CelularId")]
        public virtual Celular Celular { get; set; }

        [ForeignKey("SucursalId")]
        public virtual Sucursal Sucursal { get; set; }

        [Column("Estado")]
        public int EstadoInt { get; set; }
    }
}
